const Mock = require('mockjs')

const data = Mock.mock([{
  orgId: '@id',
  orgName: '河钢数字',
  orgFullPath: '@cname',
  'orgChildren|10': [{
    orgId: '@id',
    orgName: '@cname',
    orgFullPath: '@cname'
  }],
  'userList|10': [{
    userId: '@id',
    realName: '@cname',
    nickName: '@cname',
    checked: '@Boolean(true,false)',
    avatar: '',
    orgFullPath: '@cname'
  }]
}])
module.exports = [{
  url: '/permission/managerGroup/getManagingOrgUserList',
  type: 'get',
  response: (config) => {
    const items = data
    return {
      code: '00000',
      success: Boolean(),
      message: '@word(5)',
      data: items
    }
  }
},
{
  url: '/permission/managerGroup/getUserListByUserIds',
  type: 'get',
  response: (config) => {
    const items = data[0].userList
    return {
      code: '00000',
      success: Boolean(),
      message: '@word(5)',
      data: items
    }
  }
},
{
  url: '/permission/managerGroup/searchOrgName',
  type: 'get',
  response: (config) => {
    const items = data[0].orgChildren
    const orgData = items.filter((item) => item.orgName.indexOf(config.query.orgName) !== -1)
    return {
      code: '00000',
      success: Boolean(),
      message: '@word(5)',
      data: orgData
    }
  }
},
{
  url: '/permission/managerGroup/searchUserName',
  type: 'get',
  response: (config) => {
    const items = data[0].userList
    const userData = items.filter((item) => item.realName.indexOf(config.query.userName) !== -1)
    return {
      code: '00000',
      success: Boolean(),
      message: '@word(5)',
      data: userData
    }
  }
}
]
